<template>
  <div class="f-flex container">
    <!-- 树结构 -->
    <tree @getMessage="getMessage"></tree>

    <div class="f-flex1 content">
      <div class="f-centerY header">
        {{nodeData.title}}
        <span v-show="nodeData.items.length">{{`（${nodeData.items.length}）`}}</span>
      </div>
      <ul class="item-wrap">
        <li v-for="(item, index) in nodeData.items" :key="index" class="item">
          <div class="f-centerXY icon-wrap">
            <svg-icon :icon-class="item.icon" class-name="icon"></svg-icon>
          </div>
          <p class="title">{{item.label}}</p>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import Add from './Add.vue'
import Tree from './Tree'
export default {
  name: 'Personnel',
  components: {
    Add,
    Tree
  },
  data () {
    return {
      tree: [],
      defaultProps: {
        children: 'children',
        label: 'label',
        disabled: 'disabled'
      },
      nodeData: {  // 选中数据
        title: '',
        items: []
      },
    }
  },
  mounted () {
    console.log('route', this.$route)
  },
  methods: {
    // 新增
    append (node, data) {
      this.selectNode = node
      this.selectData = data
      this.$refs.add.toggleAdd(true, 'default')
    },
    // 获取右侧展示数据
    getMessage (data) {
      console.log(1111, data)
      this.nodeData = data
    }

  }
}
</script>

<style lang="scss" scoped>
.container {
  height: 100%;
  .content {
    border: 1px solid #ebeef5;
    box-shadow: -1px -1px 2px 0px #ebeef5;
    .header {
      padding-left: 30px;
      height: 70px;
      border-bottom: 1px solid #ebeef5;
      font-size: 17px;
      font-weight: 600;
      letter-spacing: 1px;
      color: #000;
    }
    .item-wrap {
      padding: 20px;
      .item {
        float: left;
        margin-bottom: 10px;
        margin-right: 10px;
        // padding-top: 65px;
        width: 133px;
        height: 123px;
        // background-image: url(~images/icon_images/house-blue.png);
        // background-repeat: no-repeat;
        // background-position: center 25px;
        border-style: solid;
        border-width: 2px 2px 2px 2px;
        border-color: #ebeef5;
        font-size: 24px;
        text-align: center;
        border-radius: 4px;
        cursor: pointer;
        .icon-wrap {
          height: 65px;
          .icon {
            font-size: 30px;
          }
        }
      }
      .item:hover {
        border-color: #209fff;
        box-shadow: 0px 0px 8px #209fff;
      }
    }
  }
}
</style>

